<template>
	<view>
		<view class="u-p-30">
			<u-cell-group>
				<u-cell-item @click="navigateTo('/pages/user/settings/changePasswd')" title="修改密码"></u-cell-item>
				<u-cell-item title="欢迎评分"></u-cell-item>
				<u-cell-item title="关于E学工"></u-cell-item>
				<u-cell-item title="隐私协议"></u-cell-item>
				<u-cell-item title="意见反馈"></u-cell-item>
			</u-cell-group>
		</view>
		<view v-if="access_token !== '' " class="u-p-l-30 u-p-r-30">
			<u-button @click="logOut" type="error">退出登录</u-button>
		</view>
		<u-toast ref="logOut" />
	</view>
</template>

<script>
	import {
		mapState
	} from 'vuex'
	export default {
		data() {
			return {

			}
		},
		computed: {
			...mapState(["access_token"])
		},
		methods: {
			navigateTo: function(url) {
				uni.navigateTo({
					url: url
				});
			},
			logOut() {
				// 清理本地缓存
				// uni.clearStorageSync()
				
				
				this.$u.vuex('access_token', '')
				this.$u.vuex('refresh_token', '')
				this.$u.vuex('permission', false)
				this.$u.vuex('userId', '')
				this.$u.vuex('deptId', '')
				
				this.$u.vuex('userInfo', {
					username: '',
					name: '点击立即登录'
				})
				// 清理本地缓存
				uni.clearStorageSync()
				
				this.$u.vuex('lastClockDate', '')
				this.$refs.logOut.show({
					title: '注销成功',
					type: 'success',
					isTab: true,
					url: '/pages/user/index'
				})
			}
		}
	}
</script>

<style>
</style>
